package com.hl.component;

import com.example.appxiehui2.R;

import android.content.Context;
import android.view.Gravity;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;

/**
 * 
 * @ClassName:     LoadingUI.java
 * @Description:   加载数据时候显示加载UI 
 * 
 * @author         heliang
 * @version        V1.0  
 * @Date           2013-10-14 下午5:37:56
 */
public class LoadingUI extends LinearLayout
{
    private Context context;
    
    private TextView noticeTv;
    
    /**
     * 加载时候提示信息
     */
    
    public LoadingUI(Context context,String notice)
    {
        super(context);
        this.context = context;
        
        /* 设置异步提示信息位置  */
        // 水平居中
        this.setOrientation(VERTICAL);
        // 垂直居中
        this.setGravity(Gravity.CENTER);
        // 设置背景
        this.setBackgroundResource(R.drawable.loading);
        // 设置旋转进度条
        ProgressBar progressBar = new ProgressBar(context);
        // 设置进度条大小
        LinearLayout.LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
        progressBar.setLayoutParams(lp);
        progressBar.setIndeterminateDrawable(context.getResources().getDrawable(R.drawable.progerssbar_bg));
        this.addView(progressBar);
        
        noticeTv = new TextView(context);
        noticeTv.setText(notice);      
        noticeTv.setTextSize(14);
        noticeTv.setLayoutParams(lp);
        this.addView(noticeTv);
        
    }

}
